<?php
class OrderModel extends Eloquent {
    protected $table = 'order';
    protected $primaryKey  = 'order_id';
    protected $appends = array(
   //     'pay_need'
    );
    /*
    public function getPayNeedAttribute($value){
        $pay_need = $this->pay_total - $this->pay_discount;
        return $pay_need;
    }
    */
    public function setPayNeedAttribute($value){
        //$pay_need = $this->pay_total - $this->pay_discount - $this->pay_point;
        return $value;
    }
    public function setPayTotalAttribute($value){
        $this->attributes['pay_total'] = $value;
        $this->attributes['pay_need'] = $this->pay_total - $this->pay_discount - $this->pay_point;
        return $value;
    }
    public function setPayDiscountAttribute($value){
        $this->attributes['pay_discount'] = $value;
        $this->attributes['pay_need'] = $this->pay_total - $this->pay_discount - $this->pay_point;
        return $value;
    }
}


